import { request } from '../request';

/**
 * Login
 *
 * @param userName User name
 * @param password Password
 */
export function fetchGetAllStore(params?: Api.SystemManage.UserSearchParams) {
  return request<Api.Food.StoreList>({
    url: '/store',
    method: 'get',
    params
  });
}

/**
 * Refresh token
 *
 * @param refreshToken Refresh token
 */
export function fetchAddStore(data?: Api.Food.Store) {
  return request<Api.Food.Store>({
    url: '/store',
    method: 'post',
    data
  });
}

export function fetchDeleteStore(id: number) {
  return request<Api.Food.Store>({
    url: `/${id}/store`,
    method: 'delete'
  });
}

export function fetchDeleteBatchStore(ids: string[]) {
  return request<Api.Food.Store>({
    url: `/store`,
    method: 'delete',
    data: {
      ids
    }
  });
}

export function fetchEditStore(id: number, data?: Api.Food.Store) {
  return request<Api.Food.Store>({
    url: `/${id}/store`,
    method: 'put',
    data
  });
}
